package com.it.emall.controller;


import com.it.emall.domain.Recipes;
import com.it.emall.service.NutritionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/nutrition")
public class NutritionInfoController {

    @Autowired
    private NutritionInfoService nutritionInfoService;

    @PostMapping("/generate")
    public List<Recipes> generateRecipes(@RequestParam int userId,
                                         @RequestParam int calories,
                                         @RequestParam int protein,
                                         @RequestParam int fat,
                                         @RequestParam int carbohydrate) {
        return nutritionInfoService.generateRecipes(userId, calories, protein, fat, carbohydrate);
    }
}
